<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
    <SCRIPT TYPE="text/javascript" src=../jsp/web/formvalid.js>
    </SCRIPT>
    <script>

 var req;
  var which;

  function retrieveURL(url) {
  //alert(url)
   if (window.XMLHttpRequest) { // Non-IE browsers
      req = new XMLHttpRequest();
      req.onreadystatechange = processStateChange;
      try {
         req.open("GET", url, true);
         //alert(url)
           req.send(null);
         } catch (e) {
        alert(e);
         }

         } else if (window.ActiveXObject) { // IE
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) {
      req.onreadystatechange = processStateChange;
      try {
         req.open("GET", url, true);
         //alert(url)
         req.send(null);
        } catch (e) {  alert(e);  }
      }
    }
  }

  function processStateChange() {
    if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
         document.getElementById("theTable1").innerHTML = req.responseText;
      } else {
        alert("Problem: " + req.statusText);
      }
    }
  }
</script>


<link href="../jsp/web/css.css" rel="stylesheet" type="text/css">
<link href="../css.css" rel="stylesheet" type="text/css">
</head>
<body>
<base href="<%=basePath%>">
   <base href="<%=basePath%>">
<span id="theTable1">
<SCRIPT TYPE="text/javascript"  src=../formvalid.js >
// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
function usernameFlag()
{
	alert("User Name");
	if(document.getElementById('userNameFlag').value=="false")
  {
  	alert("Change the User Name");
  	setfocus(valfield);
  } 
}

function checkIt()
{
    retrieveURL('checkavailActions.do')
   }
  function validateOnSubmit() {

    var elem;
    var errs=0;
    // execute all element validations in reverse order, so focus gets
    // set to the first one in error.
    if (!validateuserName(document.forms.demo.userName,  'inf_from'))           errs += 1;
    if (!validateuserPassword(document.forms.demo.userPassword,  'inf_password'))        errs += 1;
    if (!validateuserRePassword(document.forms.demo.userRePassword,  'inf_repassword'))        errs += 1;
	 if (!validateuserAgreement(document.forms.demo.agreement,  'inf_agreement')) errs +=1;
    if (errs>1)  alert('There are fields which need correction before sending');
    if (errs==1) alert('There is a field which needs correction before sending');

    return (errs==0);
  };
</SCRIPT>

<html:form action="/signupActions">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="left" valign="top">
    <td bgcolor="#CCCCCC">&nbsp;</td>
    <td bgcolor="#CCCCCC">&nbsp;</td>
    <td bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr align="left" valign="top">
    <td width="50%" bgcolor="#CCCCCC">&nbsp;</td>
    <td bordercolor="#FFFFFF"><table align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="1039" colspan="2" align="left" valign="top"><img src="../image/img_header.jpg" width="770" height="1"></td>
        </tr>
        <tr>
          <td colspan="2" align="left" valign="top">
            <%@ include file="header1.jsp"  %>
          </td>
        </tr>
        <tr>
          <td colspan="2" align="left" valign="top"><table border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td colspan="2" align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="star"><strong>Sign up</strong></td>
                <td colspan="2" align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="table_content">Creating a new account is easy and quck:</td>
                <td colspan="2" align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="middle" class="bule-footer">&nbsp;</td>
              </tr>
              <td align="left" valign="top" class="username">User name: </td>
                  <td align="center" valign="middle"><img src="../image/img_star.jpg" width="5" height="6"></td>
                  <td align="left" valign="top"> <html:text styleId="userName" property="userName" onblur="validateuserName(this,'inf_from');" > </html:text><html:hidden styleId="userNameFlag" property="userNameFlag" name="signupForm"/> <img src="../jsp/web/image/img_question.jpg" width="18" height="18"><FONT color="red"><html:errors property="availability"/><html:errors property="userName"/></FONT></td>
                  <td id="inf_from">.</td>
              <tr>
                <td align="left" valign="top" class="username">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="middle" class="bule-footer">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="username">Password:</td>
                <td align="center" valign="middle"><img src="../image/img_star.jpg" width="5" height="6"></td>
                <td align="left" valign="top"><html:password name="signupForm" property="passWord" onfocus="usernameFlag();" onblur="validateuserPassword(this,'inf_password');" ></html:password> <img src="../jsp/web/image/img_question.jpg" width="18" height="18"><FONT color="red"><html:errors property="userPassword"/></FONT></td>
                <td id="inf_password">.</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="username">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="username">Retype Password:</td>
                <td align="center" valign="middle"><img src="../jsp/web/image/img_star.jpg" width="5" height="6"></td>
                <td align="left" valign="top"><html:password name="signupForm"  property="retypePassword" onblur="validateuserRePassword(this,'inf_repassword');"></html:password> <img src="../jsp/web/image/img_question.jpg" width="18" height="18"><FONT color="red"><html:errors property="userRetypePassword"/></FONT></td>
                <td id ="inf_repassword">.</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td colspan="2" align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top" class="username">Type the code shown: </td>
                <td align="center" valign="middle"><img src="../jsp/web/image/img_star.jpg" width="5" height="6"></td>
                <td align="left" valign="top"><html:text name="signupForm" property="captcha"></html:text> <img src="../jsp/web/image/img_question.jpg" width="18" height="18"><FONT color="red"><html:errors property="wrongCaptcha"/></FONT></td>
              </tr>
              <tr>
                <td align="center" valign="top" class="login_b-l">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="center" valign="top" class="login_b-l">Try different image </td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top"><table border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
                    <tr>
                      <td><img src="../Captcha.jpg" width="176" height="36"></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;<html:errors property="Tag"/></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="center" valign="top"><html:checkbox property="agreement" value="true"></html:checkbox></td>
                <td align="left" valign="middle" class="table_content">&nbsp;I have read and agree QuestionForge.com Terms<br>
                  of use and Privacy Policy<br>
                  <FONT color="red"><html:errors property="useragreement"></html:errors></FONT></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="middle">&nbsp;</td>
                <td align="left" valign="middle" class="login_b-l">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="middle">&nbsp;</td>
                <td align="left" valign="middle" class="login_b-l">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top" ><a class="button_long" href="#"><span class="button_long"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Log in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span></a></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top" class="login_b-t">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top" class="login_b-t">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top" class="login_b-t"><a href="../Sign_up_2.htm"> </a> </td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td colspan="2" align="left" valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2" align="left" valign="top"><iframe src="jsp/web/footer1.jsp" width="100%" height="85"
scrolling="no"
marginwidth="0" marginheight="0" frameborder="0"> </iframe></td>
        </tr>
    </table></td>
    <td width="50%" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr align="left" valign="top">
    <td bgcolor="#CCCCCC">&nbsp;</td>
    <td bordercolor="#FFFFFF" bgcolor="#CCCCCC">&nbsp;</td>
    <td bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
</table>
</html:form>
</body>
</html>
